/**
 * Created by Administrator on 2016/11/17.
 */
/*
 * 设置（添加、种）一个cookie
 * para:
 *   name:cookie名
 *   value:cookie 值
 *   iDay: 过期日期 - 天数
 *
 * */
function setCookie(name,value,iDay){
    var str = name + '='+value+';path=/';
    //如果传入了过期天数
    if(iDay){
        var oDate = new Date();
        oDate.setDate(oDate.getDate()+iDay);
        str += ';expires='+oDate;
    }
    document.cookie = str;
}
function getCookie(name){
    var arr = document.cookie.split('; ');
    for(var i = 0; i < arr.length;i++){
        var arr2 = arr[i].split('=');
        if(name == arr2[0]){
            return arr2[1];
        }
    }

    return '';
}
function removeCookie(name){
    setCookie(name,'zns',-2)
}